home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mntdoc01.zoo / mintdoc / cat2 / fselect.nr < prev    next >
Encoding:
Text File  |  1993-03-03  |  3.6 KB  |  133 lines

  1.  
  2.  
  3.  
  4. Fselect(2)                 Oct. 1, 1991                Fselect(2)
  5.  
  6.  
  7. N✓NA✓AM✓ME✓E
  8.        Fselect - select file descriptors that are ready for read-
  9.        ing or writing
  10.  
  11. S✓SY✓YN✓NO✓OP✓PS✓SI✓IS✓S
  12.        WORD Fselect(WORD timeout, LONG *rfds, LONG *wfds, ((long)0));
  13.  
  14. D✓DE✓ES✓SC✓CR✓RI✓IP✓PT✓TI✓IO✓ON✓N
  15.        _✓F_✓s_✓e_✓l_✓e_✓c_✓t checks two  sets  of  open  file  descriptors  and
  16.        determines which have data ready to read, and/or which are
  17.        ready to be written to. If none are ready yet, the process
  18.        goes  to  sleep until some member of the sets are ready or
  19.        until a specified amount of time has elapsed.
  20.  
  21.        _✓r_✓f_✓d_✓s points to a long word which represents a set of  GEM-
  22.        DOS  file  descriptors;  bit _✓n of this long word is set if
  23.        file descriptor _✓n is to be  checked  for  input  data.  An
  24.        empty  set may optionally be represented by a NULL pointer
  25.        instead of a pointer to 0. Similarly, _✓w_✓f_✓d_✓s points to a  32
  26.        bit  long  word which indicates which file descriptors are
  27.        to be checked for output status. When _✓F_✓s_✓e_✓l_✓e_✓c_✓t returns, the
  28.        old  values  pointed to by _✓r_✓f_✓d_✓s and _✓w_✓f_✓d_✓s (if non-NULL) are
  29.        overwritten  by  new  long  words  indicating  which  file
  30.        descriptors  are  actually  ready  for reading or writing;
  31.        these will always form subsets  of  the  file  descriptors
  32.        originally specified as being of interest.
  33.  
  34.        _✓t_✓i_✓m_✓e_✓o_✓u_✓t  is a 16 bit unsigned integer specifying a maximum
  35.        number of milliseconds to wait before returning;  if  this
  36.        number  is  0,  no  maximum is set and the call will block
  37.        until one of the file descriptors specified is  ready  for
  38.        reading   or   writing,   as   appropriate.   Thus,   _✓F_✓s_✓e_✓-
  39.        _✓l_✓e_✓c_✓t(0,_✓0_✓L_✓,0L,_✓0_✓L_✓)  will   block   forever,   whereas   _✓F_✓s_✓e_✓-
  40.        _✓l_✓e_✓c_✓t(1,_✓0_✓L_✓,0L,_✓0_✓L_✓) will pause for 1 millisecond.
  41.  
  42.        The  final  argument, a long word, must always be 0 (it is
  43.        reserved for future enhancements).
  44.  
  45. R✓RE✓ET✓TU✓UR✓RN✓NS✓S
  46.        The sum of the numbers of  bits  set  in  the  long  words
  47.        pointed  to by _✓r_✓f_✓d_✓s and _✓w_✓f_✓d_✓s.  This will be 0 if the time-
  48.        out expires without any of the specified file  descriptors
  49.        becoming ready for reading or writing, as appropriate, and
  50.        nonzero otherwise.
  51.  
  52.        EIHNDL if any handle specified by the long  words  pointed
  53.        to by _✓r_✓f_✓d_✓s or _✓w_✓f_✓d_✓s is not a valid (open) GEMDOS handle.
  54.  
  55. S✓SE✓EE✓E A✓AL✓LS✓SO✓O
  56.        _✓F_✓i_✓n_✓s_✓t_✓a_✓t(2), _✓F_✓o_✓u_✓t_✓s_✓t_✓a_✓t(2)
  57.  
  58. B✓BU✓UG✓GS✓S
  59.        The  system  timer is not actually accurate to the nearest
  60.        millisecond, so the  timeout  could  last  for  up  to  19
  61.  
  62.  
  63.  
  64. Version 0.9          MiNT Programmer's Manual                   1
  65.  
  66.  
  67.  
  68.  
  69.  
  70. Fselect(2)                 Oct. 1, 1991                Fselect(2)
  71.  
  72.  
  73.        milliseconds longer than specified.
  74.  
  75.        _✓F_✓s_✓e_✓l_✓e_✓c_✓t  does not work correctly on any BIOS device except
  76.        the keyboard.
  77.  
  78.        Note that if an error condition occurs on one of the  file
  79.        descriptors  (for  example,  if  the read status of a pipe
  80.        with no more writers is being requested) then _✓F_✓s_✓e_✓l_✓e_✓c_✓t will
  81.        mark  that  file descriptor as being ready for reading (or
  82.        writing, as appropriate). This is not strictly speaking  a
  83.        bug,  since  a  subsequent  read  will  not block (it will
  84.        return an error  condition),  but  programmers  should  be
  85.        aware of the possibility.
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130. Version 0.9          MiNT Programmer's Manual                   2
  131.  
  132.  
  133.